#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QRectF>
#include <QDesktopWidget>

#include "../road/drawroaditem.h"
#include "../road/drawrectroaditem.h"
#include "../road/drawlinkitem.h"
#include "../road/drawjunctionitem.h"

#include "customtab.h"
#include "propertiesdialog/propertiesdialog.h"

#include "algorithm/spline_curves/splinecurves.h"

namespace Ui
{
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    void iniSignalSlots();
    void initUI();
    void initMenuBar();
    void initMainToolBar();
    void initTabWidget();
    void initTreeWidget();

private:
    Ui::MainWindow *ui;

    bool m_bDrawRoad;

    DrawRoadItem *m_pCurrentDrawRoadItem;
    DrawRectRoadItem *m_pCurrentDrawRectRoadItem;
    DrawLinkItem *m_pCurrentDrawLinkItem;
    DrawJunciontItem *m_pCurrentDrawJuncionItem;
    QGraphicsScene  *m_pScene;

    PropertiesDialog *m_pPropertiesDialog;

    // 菜单栏
    QAction *m_pActionMeanNew;
    QAction *m_pActionMeanOpen;
    QAction *m_pActionMeanSave;
    QAction *m_pActionMeanSaveAs;
    QAction *m_pActionMeanRename;
    QAction *m_pActionMeanDataGeneration;
    QAction *m_pActionMeanInput;
    QAction *m_pActionMeanOutput;
    QAction *m_pActionMeanBaseMapInput;
    QAction *m_pActionMeanQuit;

    QAction *m_pActionMeanAbout;

    // 工具栏
    QAction *m_pActionToolNew;
    QAction *m_pActionToolOpen;
    QAction *m_pActionToolSave;
    QAction *m_pActionToolZoomInMap;
    QAction *m_pActionToolZoomOutMap;
    QAction *m_pActionToolShowAll;

    // 元素库
    QWidget *m_pWidgetElementRoad;
    QPushButton *m_pPushBtnLineLane;
    QPushButton *m_pPushBtnCurveLane;
    QPushButton *m_pPushBtnJoinLane;

    QWidget *m_pWidgetElementTrafficSign;
//    QPushButton *m_pPushBtnWarningSign;
//    QPushButton *m_pPushBtnBanSign;
//    QPushButton *m_pPushBtnIndicateSign;
//    QPushButton *m_pPushBtnSignPostSign;

    QWidget *m_pWidgetElementPavementSign;
    QWidget *m_pWidgetElementTrafficLight;

signals:
    void setLinkRect(QRectF);

private slots:
    void on_actionRoad_triggered();
    void on_actionLink_triggered();
    void on_actionStraightWay_triggered();
    void on_actionJunction_triggered();

    void on_mouseMovePoint(QPoint point);
    void on_mouseReleasePoint(QPoint point);
//    void on_mouseMove(QPoint point);
    void on_mouseRelease(QPoint point);
    void on_mouseClicked(QPointF pointf);

    void onSendRect(QRectF qRectf);

    void on_ActionMeanAbout();
};

#endif // MAINWINDOW_H
